import i18n from '@/lang/index.js'
import {
  /*
   * 表格功能
   * Filter,Edit,Menu,Export,Keyboard,Validator
   * 可选组件
   * Column,Colgroup,Grid,Tooltip,Toolbar,Pager,Form,FormItem,FormGather,Checkbox,CheckboxGroup,Radio,RadioGroup,RadioButton,Switch,Input,Select,Optgroup,Option,Textarea,Button,Modal,List,Pulldown,
   * */
  // 全局对象
  Form,
  FormItem,
  VXETable,
  Filter,
  Modal,
  Footer,
  Icon,
  Column,
  Grid,
  Pager,
  Button,
  Toolbar,
  Checkbox,
  Input,
  Select,
  Table,
} from 'vxe-table'

export const setupVxeTable = (app) => {
  VXETable.setup({
    translate: (key, args) => (key && key.indexOf('app.') > -1 ? i18n.global.t(key, args) : key),
    icon: {
      MODAL_LOADING: '',
    },
  })
  // 表格功能
  app
    .use(Footer)
    .use(Icon)
    .use(Column)
    .use(Grid)
    .use(Pager)
    .use(Button)
    .use(Checkbox)
    .use(Form)
    .use(FormItem)
    .use(Input)
    .use(Select)
    .use(Toolbar)
    .use(Table)
    .use(Modal)
    .use(Filter)
}
